<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>我的二维码</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
		<link rel="stylesheet" type="text/css" href="css/material_QR_code_del.css" />
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script src="js/config.js"></script>
	</head>
	<style>


		
	</style>
	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<!--内容-->
<div class="my_code_list" style="margin-bottom: 1.2rem;">
	<div class="code_con" v-for="v in code_list" :data-id="v.id">
			<div class="code_list" v-if="v.template==0">
				<label class="one_choose phone_list" style="margin-right: 0.1rem;border: none;padding: 0;"><input type="checkbox" name="choose_one" value="male" style="margin-left: 0.1rem;"/>
				<div style="width: 90%;">
					<img class="code_list_img" src="img_page/code_bgp.png" />
				<img class="code_list_qr" :src="v.url" />
				</div>
				
				</label>
			</div>	
			<div class="code_list_a" v-if="v.template==0">
				<label class="one_choose phone_list" style="margin-right: 0.1rem;border: none;padding: 0;">
					<input type="checkbox" name="choose_one" value="male" style="margin-left: 0.1rem;"/>
				<div style="position: relative;width: 82%;margin-left: 4%">
					<img class="code_list_img" src="img_page/code_bgp2.png" />
				<img class="code_list_qr_a" :src="v.url" />
				</div>
				</label>
			</div>
		</div>
	
</div>
		
		
		<!--底部-->
		<div class="material_bottom">
			<label class="single" onclick="choose_all(this)"><input type="checkbox" name="sex" value="male" />全选</label>
			<button class="material_photo_del" onclick="del_all()">删除</button>
		</div>
		<!--弹出层-->
		<div id="bgMask" class="bg" style=""></div>
		<!--灰度背景-->
		<!--弹出层内容-->
		<div id="infoBox" style="" class="infobox_del">
			<div class="infobox_del_con">确认删除？</div>
			<div class="infobox_del_bottom">
				<button onclick="hideInfoBox();">取消</button>
				<button onclick="sureInfoBox();">确定</button>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var code_list=new Vue({
			el:'.my_code_list',
			data:{
				code_list:[]
			},
			created: function() {
				this.getList();
			},
			methods:{
				getList: function() {
					console.log("11111");
					var that = this;
					$.ajax({
						type: "get",
						url: v_url + "/wechat/material/getWxQrList",
						data: {
c_user_id:c_user_id
						},
						async: true,
						success: function(res) {
							var list = res.data;

							that.code_list = list;

							console.log(list);
						}
					});

				}
			}
		})
	/**遮罩层弹出与隐藏*/
		//记录是否阻止滚动
		var disableScroll = false;
		var ids = '';
		//如果弹出对话框时，底层的视图就不让滚动了
		document.addEventListener('touchmove', function(e) {
			if(disableScroll) {
				e.preventDefault();
			}
		}, false); //显示弹出框
		function del_all() {
			//禁止滚动
			disableScroll = true;

			var lab_name = document.getElementsByName('choose_one')
			for(var i = 0; i < lab_name.length; i++) {
				if(lab_name[i].checked) {
					var id = $(lab_name[i]).parent().parent().parent().attr("data-id");
					console.log(id)
					if(ids) {
						ids = ids + "," + id;
					} else {
						ids = id
					}
				}

			}
//			console.log(ids)
			if(!ids) {
				layer.msg('请至少选择一个')
			} else {
				//显示背景遮罩
				document.getElementById("bgMask").style.display = "block";
				//显示消息弹出框
				document.getElementById("infoBox").style.display = "block";
			}

		}

		//隐藏弹出框
		function hideInfoBox() {
			//允许滚动
			disableScroll = false;
			//隐藏背景遮罩
			document.getElementById("bgMask").style.display = "none";
			//隐藏消息弹出框
			document.getElementById("infoBox").style.display = "none";
		}
		//点击确定
		function sureInfoBox() {

			$.ajax({
				type: "get",
				url: v_url + "/wechat/material/deleteWxQr",
				data: {
					ids: ids,
					c_user_id:c_user_id
				},
				async: true,
				success: function(res) {
					if(res.code = 200) {
						layer.msg('删除成功',function(){
							window.location.reload();
						})
						
					}

				},
				error: function(request) {
					console.log("删除失败")
				}

			});

			//允许滚动
			disableScroll = false;
		}
		function choose_all(obj){
			var dom = $(obj).find("input");
			
				$(".one_choose").each(function(i){
					var dom2 = $(this).find("input");
					dom2.prop("checked", dom.prop("checked"));
				});
			
			 

		}
		
	</script>
</html>
